<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
if( file_exists('stop.php') ) {
	include_once('stop.php');
}

//
require(dirname(dirname(__FILE__)) . '/includes/application_top.php');

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'module/menu/menu.class.php');
$mObj = new MenuBase();
$mObj->format = true;
$mObj->owner = '1';

//
$adb->query("delete from `pp_menus` where menus_owner = '1'");

//
$items = array(
		'A' => array(
				'name' => 'ECE簡介',
				'link' => 'ECE-Introduction',
				'subs' => array(
						'1' => '序文',
						'2' => '名稱由來',
						'3' => '成立目的',
						'4' => '願景&使命',
						'5' => '跨越典型',
						'6' => '與眾不同',
						'7' => '主要服務',
						'8' => '首要職員',
						'9' => '專業團隊',
							),
					),
		'B' => array(
				'name' => '服務內容',
				'link' => 'Services',
				'subs' => array(
						'1' => '在台服務',
						'2' => '在美服務',
						'3' => '配套方案',
						'4' => '服務流程',
						'5' => '應變機制',
						'6' => '緊急回應流程(CERT)',
						'7' => '緊急回應組織(CERT)',
						'8' => '退費政策',
							),
					),
		'C' => array(
				'name' => '美國百科',
				'link' => 'American-Encyclopedia',
				'subs' => array(
						'1' => '美國簡介',
						'2' => '五十州',
						'3' => '各大城市',
						'4' => '教育體制',
						'5' => '各地生活開銷 & 治安狀況',
							),
					),
		'D' => array(
				'name' => '簽證與學校',
				'link' => 'Visa-School',
				'subs' => array(
						'1' => '非移民簽證',
						'2' => '入學準備時間',
						'3' => '簽證資格',
						'4' => '向學校提出申請',
						'5' => '申請非移民簽證',
						'6' => '單位資訊',
							),
					),
		'E' => array(
				'name' => '相關資訊',
				'link' => 'Information',
				'subs' => array(
						'1' => '行前準備清單',
						'2' => '出入境美國',
						'3' => '銀行資訊',
						'4' => '醫療與保險',
						'5' => '國外學歷採認辦法',
						'6' => '國外學歷採認辦法(圖表)',
						'7' => '考試資訊與申請文件',
							),
					),
		'F' => array(
				'name' => 'ECE會員需知',
				'link' => 'ECE-Members',
				'subs' => array(
						'1' => '學員行為政策',
						'2' => '緊急回應團隊合約(CERT)',
						'3' => 'ECE服務合約',
						'4' => 'ECE 應急卡',
							),
					),
		'G' => array(
				'name' => '聯絡ECE',
				'link' => 'Contact-ECE',
				'subs' => array(
						'1' => 'Company Info.',
							),
					),
			);							


//
$i = 0;
foreach($items as $key => $item) {
	$i++;
	$d = array();
	$d['_name'] = $item['name'];
	$d['_link'] = $item['link'];
	$d['_sort_order'] = $i;
	
	$items[$key]['id'] = $mObj->addItem($d);
}

//
foreach($items as $key => $item) {
	if( is_array($item['subs']) ) {
		$i = 0;
		foreach($item['subs'] as $k => $v) {
			$i++;
			$d = array();
			$d['_name'] = $v;
			$d['_link'] = $item['link'] . '-' . $i;
			$d['_parent'] = $item['id'];
			$d['_sort_order'] = $i;
			
			$mObj->addItem($d);
		}
	}
}

//
echo 'OK';
//
?>